package com.eques.demo.adapter.viewhoder

import android.content.Context
import android.view.View
import android.widget.TextView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.eques.bean.AnimalMsgInfo
import com.eques.demo.R
import com.eques.demo.adapter.MsgAdapter

import com.eques.icvss.utils.ELog
import com.eques.impl.OnClickListenerImpl

@Suppress("DEPRECATION")
class MsgHoder(itemView: View?) : RecyclerView.ViewHolder(itemView!!) {

    private val tv_day: TextView = itemView!!.findViewById(R.id.tv_day)
    private val rec_msg_data: RecyclerView = itemView!!.findViewById(R.id.rec_msg_data)

    fun setData(context: Context, animalAlarmInfos: List<AnimalMsgInfo>, position:Int, onItemClickListener: OnClickListenerImpl) {
        ELog.d("data_base_data..msg 33333.",animalAlarmInfos[position].day)
        tv_day.text= animalAlarmInfos[position].day
        var linearLayoutManager=LinearLayoutManager(context)
        linearLayoutManager.orientation=LinearLayoutManager.VERTICAL
        rec_msg_data.layoutManager =linearLayoutManager
        var adapter= MsgAdapter(context,position,animalAlarmInfos[position].tabE1ProAlarmMsgInfo)
        adapter.setOnItemClickListener(onItemClickListener)
        rec_msg_data.adapter =adapter

    }
}